package com.atLsc.controller;

import com.atLsc.dao.GoodsDao;
import com.atLsc.dao.TblUserDao;
import com.atLsc.dao.UserDao;
import com.atLsc.dynamic.annotation.DataSource;
import com.atLsc.entity.Goods;
import com.atLsc.entity.TblUser;
import com.atLsc.entity.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName: DynamicController
 * Package: com.atLsc.controller
 *
 * @Date: 2022-03-16 15:07
 * @author: joey
 * @Description:
 */
@RestController
@RequestMapping("dynamic")
public class DynamicController {

    @Autowired
    private GoodsDao goodsDao;
    @Autowired
    private TblUserDao tblUserDao;
    @Autowired
    private UserDao userDao;


    @GetMapping("/test")
    //@DataSource("slave1")
    public void test(){
        System.out.println("进入test=====");
//        QueryWrapper wrapper = new QueryWrapper();
//        List<Goods> list1 = goodsDao.selectList(wrapper);
        List<Goods> list1 = goodsDao.queryAll(null);

//       List<TblUser> list2 = tblUserDao.selectList(wrapper);
//        List<User> list3 = userDao.selectList(wrapper);
       for (Goods user : list1){
           System.out.println(user);
       }
//        System.out.println(list2);
//        System.out.println(list3);

    }

}
